import java.io.IOException;
import java.net.SocketException;

import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;


public class SimpleFtpApp {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		FTPClient client = new FTPClient();
		try {
			client.connect("ftp.ncbi.nlm.nih.gov");
			client.login("anonymous", "anonymous");
			client.enterLocalPassiveMode();
			client.changeWorkingDirectory("sra/Studies/");
			client.changeWorkingDirectory("SRP000/SRP000704/SRX003801");
			for (FTPFile f : client.listFiles()) {
				System.out.println(f.getName());
			}
			System.out.println("The end");
			client.disconnect();
		} catch (SocketException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
